#ifndef _LIGHT_FAT32_
#define _Light_fat32_

typedef struct PART_INFO
{
        char MBR_IS_BOOT;
        char MBR_CHS_START[3];
        char MBR_PART_TYPE;
        char MBR_CHS_END[3];
        char MBR_LBA_SEC[4];
        char MBR_PART_SIZE[4];
}PART_INFO_t;

typedef struct MBR
{
        char MBR__bootcode[446];
        PART_INFO_t mbr_part_info[4];
        char MBR_END[2];
}MBR_t;

typedef struct
{
        char DBR_JUMP[3];
        char DBR_VERSION[8];
        char DBR_SEC_BYTES[2];
        char DBR_CLUSTER_SECS[1];
        char DBR_REVSERD_SECS[2];
        char DBR_FAT_TABLE_CNT[1];
        char DBR[11];
        char DBR_SEC_USED[4];
        char DBR_FS_SECS[4];
        char DBR_FAT_SECS[4];
        char DBR1[4];
        char DBR_ROOT_CUTNO[4];
        char DBR2[2+2+12+3+4];
        char DBR_LABEL[11];
        char DBR_FS_NAME[8];
        char DBR3[420];
        char DBR_END[2];
}DBR_t;

typedef struct
{
        char ENTRY_FILE_NAME[8];
        char ENTRY_FILE_TAIL[3];
        char ENTRY_FILE_ATTR;
        char ENTRY_RESERVED;
        char ENTRY_CTIME_U;
        char ENTRY_CTIME_HMS[2];
        char ENTRY_CDATE[2];
        char ENTRY_RDATE[2];
        char ENTRY_CUTNO_H[2];
        char ENTRY_LSTIME[2];
        char ENTRY_LSDATE[2];
        char ENTRY_CUTNO_L[2];
        char ENTRY_FILE_SIZE[4];
}FILE_ENTRY_t;

typedef struct
{
        unsigned int HOUR;
        unsigned int MIN;
        unsigned int SEC;

}TIME_t;

typedef struct
{
        unsigned int YEAR;
        unsigned int MON;
        unsigned int DAY;
}DATE_t;


typedef struct
{
        char FILE_NAME[8];
        char FILE_TAIL[3];
        char FILE_ATTR;
        unsigned int FILE_SIZE;
        TIME_t CTIME;
        DATE_t CDATE;
        DATE_t RDATE;
        TIME_t LSTIME;
        DATE_t LSDATE;
        unsigned int FILE_CUTNO;
}FILE_TYPE_t;


typedef struct
{
   int fd;
   FILE_TYPE_t file;
}FILE_t;

typedef struct
{
        unsigned int cutno;
        unsigned char type;
}HANDLE_t;

typedef struct
{
        MBR_t mbr;
        DBR_t dbr0;

        unsigned int fat1_at;
        unsigned int fat2_at;
        unsigned int root_at;
        unsigned char secs_per_cut;
}FAT32_t;


typedef struct
{
        char LT_DRIVER_NAME[8];
        int (*init)();
        int (*read_sector)(int secno, unsigned char *buf, int seccnt);
        int (*write_sector)(int secno, unsigned char *buf, int seccnt);
        unsigned char part_num;
        	
}DRIVER_t;


#endif
